package com.bawei.module_player.adapter.provider

import androidx.databinding.DataBindingUtil
import com.bawei.library_common.utils.DateTimeUtils
import com.bawei.module_player.PlayerEntity
import com.bawei.module_player.databinding.PlayerReplayViewBinding
import com.bawei.module_player.databinding.PlayerTitlteViewBinding
import com.chad.library.adapter.base.provider.BaseItemProvider
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @Author : yaotianxue
 * @Time : On 2023/6/12 11:15
 * @Description : ReplayProvider
 */
class ReplayProvider(override val itemViewType: Int, override val layoutId: Int) :BaseItemProvider<PlayerEntity.Item>() {
    override fun convert(helper: BaseViewHolder, item: PlayerEntity.Item) {
        helper.getBinding<PlayerReplayViewBinding>()?.item = item

        //发布时间
        helper.getBinding<PlayerReplayViewBinding>()?.tvUserReleaseTime?.text ="发布于"+DateTimeUtils.getDateForNew(
           item.data.createTime.toString(),"hh:mm"
        )

    }

    override fun onViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        DataBindingUtil.bind<PlayerReplayViewBinding>(viewHolder.itemView)
    }
}